function Album(albumId, albumName, albumDescription) {
	
	var _selectedPhotos = [] ;
	var _unselectedPhotos = [] ;
	
	var _id = albumId ;
	var _name = albumName ;
	var _description = albumDescription ;
		
	//Bindings	
	this.addPhotoToAlbum = addPhotoToAlbum;
	this.addPhotoToUnselectedPhotos = addPhotoToUnselectedPhotos;
	this.getSelectedPhotos = getSelectedPhotos;
	this.getEventUnselectedPhotos = getEventUnselectedPhotos;
	this.getPhotoEntityByElementName = getPhotoEntityByElementName;
	this.getPhotoEntityByURL = getPhotoEntityByURL;
	this.getSelectedPhotosIds = getSelectedPhotosIds;
	this.getId = getId
	this.addAllToShoppingCart = addAllToShoppingCart;
	this.getName = getName
	this.getDescription = getDescription
	
	function getId() {
		return _id;
	}
	
	function getName() {
		return _name;
	}
	
	function getDescription() {
		return _description;
	}

	function addPhotoToAlbum(aPhoto){				
		_selectedPhotos.push(aPhoto);			
		var idx = _unselectedPhotos.indexOf(aPhoto); // Find the index
		if(idx!=-1) _unselectedPhotos.splice(idx, 1);
				
	}
	
	function addPhotoToUnselectedPhotos(aPhoto){		
		_unselectedPhotos.push(aPhoto);
		var idx = _selectedPhotos.indexOf(aPhoto); // Find the index
		if(idx!=-1) _selectedPhotos.splice(idx, 1);		
	}
	
	function getSelectedPhotos(){
		return _selectedPhotos;
	}
	
	function getSelectedPhotosIds(){		
		var selectedPhotosIDs = [] ;
		for (i=0; i<_selectedPhotos.length; i++)
		{
		  var photo = _selectedPhotos[i];		  
		  selectedPhotosIDs.push(photo.getId());
		}		
		return selectedPhotosIDs;
	}
	
	function getEventUnselectedPhotos(){
		return _unselectedPhotos;
	}	
	
	function getPhotoEntityByElementName(name){
		// Itero las seleccionadas
		for (i=0; i<_selectedPhotos.length; i++)
		{
		  var photo = _selectedPhotos[i];
		  if (photo.getElementName()==name){
			  return photo;
		  }
		}
		// Itero las no seleccionadas
		for (i=0; i<_unselectedPhotos.length; i++)
		{
		  var photo = _unselectedPhotos[i];
		  if (photo.getElementName()==name){
			  return photo;
		  }
		}
		return undefined;
	}
	
	function getPhotoEntityByURL(url){
		var urlName = getUrlPhotoName(url);		
		// Itero las seleccionadas
		for (i=0; i<_selectedPhotos.length; i++)
		{
			
			var photo = _selectedPhotos[i];
			
			if (getUrlPhotoName(photo.getUrl()) == urlName){
				
				return photo;
			}
		}
		// Itero las no seleccionadas
		for (i=0; i<_unselectedPhotos.length; i++)
		{
		  var photo = _unselectedPhotos[i];
		  if (getUrlPhotoName(photo.getUrl()) == urlName){
			  
			  return photo;
		  }
		}		
		return undefined;
	}
	
	function getUrlPhotoName(url){		
		var substr = url.split('/');
		return substr[substr.length-1];
	}
	
	function addAllToShoppingCart(){
		for (i=0; i<_selectedPhotos.length; i++){			
			var photo = _selectedPhotos[i];
			photo.setInCart(true);   		
		}
	}
}